package cn.itsource.ymcc.openfeign.factory;

import cn.itsource.ymcc.domain.Login;
import cn.itsource.ymcc.openfeign.LoginOpenfeign;
import cn.itsource.ymcc.result.JsonResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class LoginOpenfeignFallbackFactory implements FallbackFactory<LoginOpenfeign> {
    @Override
    public LoginOpenfeign create(Throwable throwable) {
        return new LoginOpenfeign() {
            @Override
            public JsonResult saveOrUpdate(Login login) {
                log.info("LoginOpenfeign服务掉用失败");
                return JsonResult.error("服务掉用失败");
            }
        };
    }
}
